package com.yloveg.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yloveg.dao.ShopOrdersMapper;
import com.yloveg.entity.ShopOrders;
import com.yloveg.service.ShopOrdersService;

@Service
public class ShopOrdersServiceImpl implements  ShopOrdersService {
	
    @Autowired
    private ShopOrdersMapper shopOrdersMapper;

	@Override
	public PageInfo<ShopOrders> queryOrdersPage(int page, int limit, ShopOrders record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(page, limit);
		List<ShopOrders> shopList = shopOrdersMapper.queryShops(record);
		PageInfo<ShopOrders>resultPage=new PageInfo<ShopOrders>(shopList);
		return resultPage;
	}

	@Override
	public int insertOrder(ShopOrders record) {
		// TODO Auto-generated method stub
		record.setCreateTime(new Date());
		record.setState(1);
		return shopOrdersMapper.insert(record);
	}

	@Override
	public int updateByPrimaryKeySelective(ShopOrders record) {
		// TODO Auto-generated method stub
		record.setUpdateDate(new Date());
		return shopOrdersMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public ShopOrders selectByPrimaryKey(Long id) {
		// TODO Auto-generated method stub
		return shopOrdersMapper.selectByPrimaryKey(id);
	}







 


}
